<?php


namespace App\Models;


use Illuminate\Database\Eloquent\Model;

class PickingDetail extends Model
{
    protected $table = 'picking_detail';

    protected $fillable = ['order_id', 'batch_inventory_id', 'product_id', 'barcode', 'quantity'];

    public function order(){
        return $this->belongsTo(Order::class);
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * @author luffyzhao@vip.126.com
     */
    public function shipment(){
        return $this->belongsTo(OrderShipment::class, 'order_id', 'order_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function product(){
        return $this->belongsTo(Product::class);
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function batchInventory(){
        return $this->belongsTo(BatchInventory::class)->withTrashed();
    }
}
